package com.codeman.bytebuddy.component;

import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.io.IOException;

@Component
public class AppInit implements SmartInitializingSingleton {

    @Resource
    private ByteBuddyService byteBuddyService;

    @Override
    public void afterSingletonsInstantiated() {
        try {
            ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
            String name1 = "com.codeman.bytebuddy.virtual.GroupUserExcelVO";
            byteBuddyService.makeGroupUserExcelVOClass(contextClassLoader);
            Class<?> class1 = ByteBuddyService.VIRTUAL_CLASS_MAP.get(name1);
            byteBuddyService.makeProjectGroupExcelVOClass(class1, class1.getClassLoader());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
